//
//  CancelView.swift
//  SampleApp
//
//  Created by Kevin on 2019/7/2.
//  Copyright © 2019 Kevin. All rights reserved.
//

import UIKit

class CancelView: UIView {
    
    var callback:() -> Void = {}
    
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        
        let x = rect.origin.x
        let y = rect.origin.y
        
        let path = UIBezierPath()
        path.move(to: CGPoint(x: x, y: y))
        // 线条1
        path.addLine(to: CGPoint(x: x , y: y))
        path.addLine(to: CGPoint(x: x + 15, y: y + 15))
        // 线条2
        path.move(to: CGPoint(x: x + 15, y: y))
        path.addLine(to: CGPoint(x: x, y: y + 15))
        
        // 宽度
        path.lineWidth = 2
        // 颜色
        UIColor.gray.setStroke()
        // 渲染
        path.stroke()
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        self.callback()
    }
}
